import $http from '@/assets/js/http'

//获得商品列表
export function getGoodList(name, index, size) {
    return $http.get('/manage/goods/list', {
        params: { goodsName: name, pageIndex: index, pageSize: size }
    });
}
//获得商品详情
export function getcGoodDetails(id) {
    return $http.get('/manage/goods/detail', {
        params: { goodsId: id }
    });
}
//删除商品规格
export function postspecIdDelete(delId) {
    return $http.post('/manage/goods/spec/delete', {
        specId: delId
    })
}

//商品下架
export function postGoodDelete(delId) {
    return $http.post('/manage/goods/delete', {
        goodsId: delId
    })
}
//新增商品
export function postGoodAdd(param) {
    return $http.post('/manage/goods/add', {
        goodsName: param.goodsName,
        headImg: param.headImg,
        bannerImg: param.bannerImg,
        title: param.title, //商品副标题
        deliveryTime: param.deliveryTime,
        freightMoney: param.freightMoney,
        refundType: param.refundType,
        freeShipping: param.freeShipping,
        detail: param.detail,
        specJson: param.specJson
    })
}
//编辑商品
export function postGoodEdit(param) {
    return $http.post('/manage/goods/update', {
        goodsId: param.goodsId,
        goodsName: param.goodsName,
        headImg: param.headImg,
        bannerImg: param.bannerImg,
        title: param.title, //商品副标题
        deliveryTime: param.deliveryTime,
        freightMoney: param.freightMoney,
        refundType: param.refundType,
        freeShipping: param.freeShipping,
        detail: param.detail,
        specJson: param.specJson
    })
}

//秒杀列表
export function getSeckillList() {
    return $http.get('/manage/goods/seckill/list', {
        params: {}
    });
}
export function getSeckillSet(param) {
    return $http.post('/manage/goods/seckill/set', {
        id: param.id,
        startTime: param.startTime,
        endTime: param.endTime,
        goodsIdList: param.goodsIdList
    });
}
//设置秒杀活动

export function getSeller(pgeSize) {
    return $http.get('api/mall/fine/seller', {
        params: { limitNum: pgeSize }
    });
}
export function getLbsSeller(longitude, latitude, pageIndex, pgeSize) {
    //经度 纬度  分页参数页码 分页参数每页条数
    return $http.get('api/mall/lbs/seller', {
        params: { longitude: longitude, latitude: latitude, pageIndex: pageIndex, pageSize: pgeSize }
    });
}
//设置秒杀商品销量
export function postSetSales(param) {
    return $http.post('/manage/goods/setSalesValume', {
        goodsId:param.goodsId,
        selledStock:param.selledStock,
    });
}